#!/usr/bin/env bash

SERVICE_NAME="ac-julink"
crictl ps -a  |grep $SERVICE_NAME | awk '{print $1}' | while read line
do
  slice_name_suffix=`systemd-cgls --unit kubepods.slice --no-pager |grep $line | cut -d '-' -f2`
  slice_name="crio-$slice_name_suffix"
  echo """————————————————————————————
cgroup for pod $line
————————————————————————————
  """
  systemctl show --no-pager $slice_name | grep Memory
done

# see all the pod in systemd
systemd-cgls --unit kubepods.slice --no-page

POD_ID="$(crictl pods --name $SERVICE_NAME -q)"
crictl inspectp -o=json $POD_ID | jq .info.runtimeSpec.linux.cgroupsPath -r


# IN POD
cat /sys/fs/cgroup/memory/memory.stat